<div class="form">

    <?php
    /**
     * @var $form CActiveForm
     * @var $model Video
     */
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'video-form',
        'enableAjaxValidation' => false,
    ));
    ?>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'title'); ?>
        <?php echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 255)); ?>
        <?php echo $form->error($model, 'title'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'youtube'); ?>
        <?php echo $form->textField($model, 'youtube', array('size' => 60, 'maxlength' => 255)); ?>
        <div class="hint">Đường link xem của video trên youtube.com</div>
        <?php echo $form->error($model, 'youtube'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'file_id'); ?>
        <?php //echo $form->textField($model, 'file_id'); ?>
        <?php
        $this->widget('ext.EAjaxUpload.EAjaxUpload',
            array(
                'id' => 'uploadFile',
                'config' => array(
                    'action' => Yii::app()->createUrl('upload/video', array('ctype' => 'video')),
                    'allowedExtensions' => array("flv", "mp4","avi"), //array("jpg","jpeg","gif","exe","mov" and etc...
                    'sizeLimit' => 10 * 1024 * 1024, // maximum file size in bytes
                    'minSizeLimit' => 100*1024, // minimum file size in bytes
                    'onComplete' => "js:function(id, fileName, responseJSON){ $('#Video_file_id').val(responseJSON.item_id); }",
                )
            ));
        echo $form->hiddenField($model,'file_id');
        ?>
        <?php echo $form->error($model, 'file_id'); ?>
    </div>
    <div class="row">
        <?php echo $form->labelEx($model, 'img'); ?>
        <?php //echo $form->textField($model, 'file_id'); ?>
        <?php
        $this->widget('ext.EAjaxUpload.EAjaxUpload',
            array(
                'id' => 'uploadImage',
                'config' => array(
                    'action' => Yii::app()->createUrl('upload/image', array('ctype' => 'video')),
                    'allowedExtensions' => array("jpg","jpeg","gif","png"), //array("jpg","jpeg","gif","exe","mov" and etc...
                    'sizeLimit' => 10 * 1024 * 1024, // maximum file size in bytes
                    'minSizeLimit' => 100*1024, // minimum file size in bytes
                    'onComplete' => "js:function(id, fileName, responseJSON){ $('#Video_img').val('upload/images/'+responseJSON.filename); }",
                )
            ));
        echo $form->hiddenField($model,'img');
        ?>
        <?php echo $form->error($model, 'img'); ?>
    </div>
    <div class="row">
        <?php echo $form->labelEx($model, 'body'); ?>
        <?php
        //echo $form->textArea($model, 'body', array('rows' => 6, 'cols' => 50));
        $this->widget('application.extensions.ckeditor.CKEditor', array(
            'model'=>$model,
            'attribute'=>'body',
            'language'=>'vi',
            'editorTemplate'=>'full',
        ));
        ?>
        <?php echo $form->error($model, 'body'); ?>
    </div>
   <div class="row">
        <?php echo $form->labelEx($model, 'status'); ?>
        <?php
        //echo $form->textField($model, 'status');
       echo $form->listBox($model,'status',array(1=>'Hoạt động',2=>'Không hoạt động'),array('size'=>1));
       ?>
        <?php echo $form->error($model, 'status'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'is_trade'); ?>
        <?php
        //echo $form->textField($model, 'is_trade');
        echo $form->radioButtonList($model,'is_trade',array(1=>'Không thu phí',2=>'Thu phí'));
        ?>
        <?php echo $form->error($model, 'is_trade'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'cat_id'); ?>
        <?php echo $form->listBox($model, 'cat_id',$this->listVideoCat(),array('size'=>1)); ?>
        <?php echo $form->error($model, 'cat_id'); ?>
    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->